<script setup>
import { ref,onMounted  } from 'vue'
import {WordPaster} from '/public/WordPaster/js/w'
import {zyCapture} from '/public/zyCapture/z'
import {zyOffice} from '/public/zyOffice/js/z'
import '/public/UEditor/ueditor.config'
import '/public/UEditor/ueditor.all.min'
import '/public/WordPaster/css/w.css'
import '/public/layer-v3.1.1/layer/layer'
import '/public/layer-v3.1.1/layer/theme/default/layer.css'

const msg = '<p>泽优全平台内容发布解决方案 for vue3-cli-ueditor1.5</p><p>泽优全平台Word一键粘贴控件（WordPaster）</p><p>泽优全平台截屏控件（zyCapture）</p><p>泽优Office文档转换服务（zyOffice）</p>'
const editorConfig={
    UEDITOR_HOME_URL: '/public/UEditor/', // 访问 UEditor 静态资源的根路径，可参考常见问题1
    serverUrl: '//ueditor.szcloudplus.com/cos', // 服务端接口（这个地址是我为了方便各位体验文件上传功能搭建的临时接口，请勿在生产环境使用！！！）
}
//初始化
WordPaster.getInstance({
    //上传接口：http://www.ncmem.com/doc/view.aspx?id=d88b60a2b0204af1ba62fa66288203ed
    PostUrl:"http://localhost:8891/upload.aspx",
	//为图片地址增加域名：http://www.ncmem.com/doc/view.aspx?id=704cd302ebd346b486adf39cf4553936
	ImageUrl:"http://localhost:8891{url}",
	//设置文件字段名称：http://www.ncmem.com/doc/view.aspx?id=c3ad06c2ae31454cb418ceb2b8da7c45
	FileFieldName: "file",
	//提取图片地址：http://www.ncmem.com/doc/view.aspx?id=07e3f323d22d4571ad213441ab8530d1
	ImageMatch: ''  
});

// zyCapture
zyCapture.getInstance({
    config: {
        PostUrl: "http://localhost:8891/upload.aspx",
        License2: '',
        FileFieldName: "file",
        Fields: { uname: "test" },
        ImageUrl: 'http://localhost:8891{url}'
    }
})

zyOffice.getInstance({
    word:"http://localhost:13710/zyoffice/word/convert",
    wordExport:"http://localhost:13710/zyoffice/word/export",
    pdf:"http://localhost:13710/zyoffice/pdf/upload"
})

function ueready(edt){
  //WordPaster快捷键 Ctrl + V
  edt.addshortcutkey({
      "wordpaster": "ctrl+86"
  });
  window.zyCapture.setEditor(edt);
}

</script>

<template>
  <vue-ueditor-wrap v-model="msg" :config="editorConfig" editor-id="editor1" @ready="ueready"></vue-ueditor-wrap>
  <p>第二个编辑器</p>
  <vue-ueditor-wrap v-model="msg" :config="editorConfig" editor-id="editor2" @ready="ueready"></vue-ueditor-wrap>  
</template>

<style scoped>
a {
  color: #42b983;
}
</style>
